//
//  HiddenNavController.m
//  SmoothNavDemo
//
//  Created by 崔宝印 on 2018/3/2.
//  Copyright © 2018年 Cloudox. All rights reserved.
//

#import "HiddenNavController.h"
#import "WhiteNavController.h"
#import "AlphaViewController.h"
#import "HiddenNavController.h"
#import "NormalDarkController.h"

@interface HiddenNavController ()

@end

@implementation HiddenNavController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor yellowColor];
    [self addSubviews];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.navigationController.navigationBarHidden = NO;
}

#pragma mark - Methods
- (void)addSubviews
{
    [self.view addSubview:[self buttonWithTitle:@"goNormalLightNav" index:1]];
    [self.view addSubview:[self buttonWithTitle:@"goNormalDarkNav" index:2]];
    [self.view addSubview:[self buttonWithTitle:@"goAlphaNav" index:3]];
    [self.view addSubview:[self buttonWithTitle:@"goHiddenNav" index:4]];
    [self.view addSubview:[self buttonWithTitle:@"goBack" index:5]];
}

- (UIButton *)buttonWithTitle:(NSString *)btnTitle index:(int)index
{
    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, 100 * (index + 1), 200, 50)];
    [btn setTitle:btnTitle forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [btn addTarget:self action:NSSelectorFromString(btnTitle) forControlEvents:UIControlEventTouchUpInside];
    return btn;
}

#pragma mark - Action
- (void)goBack
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)goAlphaNav
{
    AlphaViewController *controller = [[AlphaViewController alloc] init];
    controller.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:controller animated:YES];
}

- (void)goNormalDarkNav
{
    NormalDarkController *controller = [[NormalDarkController alloc] init];
    controller.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:controller animated:YES];
}

- (void)goNormalLightNav
{
    WhiteNavController *controller = [[WhiteNavController alloc] init];
    controller.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:controller animated:YES];
}

- (void)goHiddenNav
{
    HiddenNavController *controller = [[HiddenNavController alloc] init];
    controller.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:controller animated:YES];
}

@end
